//Header file definition for file writers that Lambda uses
#ifndef __FILEWRITERS_H__
#define __FILEWRITERS_H__

#pragma once
#include<fstream>
#include "Color3.h"

//PPM file writer
//We will write only binary files - speed
//Max component is 255 for RGB
class PPMFileWriter
{
public:
	//screen resolution
	int width;
	int height;
	//file info
	char* filepath;
	std::ofstream ofile;		//output file
	unsigned char* buffer;		//buffer that will be used to write store pixel values

	//constructor
	PPMFileWriter();
	PPMFileWriter(char* filename, int width, int height);

	//Writing functions
	void PutPixel(int x, int y, unsigned char color);		//now we will use only a monochrome image
	void PutPixel(int x, int y, const Color3& C);
	void WriteFile();
	bool CopyImageBuffer(unsigned char* src_buffer, size_t buffer_size);		//this function copies any buffer to image buffer
	bool CopyImageBuffer(Color3* color_buffer, size_t buffer_size, float gamma = 1.0f);

	//Destructor
	~PPMFileWriter();
};


#endif